package com.linys.scala.study.pattern

import scala.util.matching.Regex

/**
  * Created by admin on 2019/10/15.
  */
object Pattern {

  def main(args: Array[String]) {
    val pattern = "(S|s)cala".r
    val str = "Scala is scalable and cool"

    println((pattern findAllIn str).mkString(","))

    val str2 = "Scala is scalable and cool"
    println(pattern replaceFirstIn(str2, "Java"))

    val pattern1 = new Regex("abl[ae]\\d+")
    val str3 = "ablaw is able1 and cool"

    println((pattern1 findAllIn str3).mkString(","))

  }

}
